package com.by;

/**
 * @version 1.0
 * @Author 彭彦彬
 * @Date 2025/4/12 15:36
 * @注释
 */
// 适配器类
public class MediaAdapter implements MediaPlayer {

    private AdvancedMediaPlayer advancedMediaPlayer;

    public MediaAdapter(String audioType) {
        if (audioType.equalsIgnoreCase("vlc")) {
            advancedMediaPlayer = new VlcPlayer();
        } else if (audioType.equalsIgnoreCase("wav")) {
            advancedMediaPlayer = new WavPlayer();
        }
    }

    @Override
    public void play(String audioType, String fileName) {
        if (audioType.equalsIgnoreCase("vlc")) {
            advancedMediaPlayer.playVlc(fileName);
        } else if (audioType.equalsIgnoreCase("wav")) {
            advancedMediaPlayer.playWav(fileName);
        }
    }
}